﻿/**
 * BaseDao.java 1.0 2007-4-19 上午02:51:12,创建 by yangfan
 */


package org.in4j.core.dao;

import java.io.Serializable;
import java.util.List;

import org.hibernate.Query;
import org.hibernate.criterion.DetachedCriteria;
import org.in4j.core.dao.support.Pagination;

/**
 *
 * @author 杨帆
 * @version 1.0 2007-4-19 上午02:51:12,创建
 */
public interface BaseDao<T>
{
	public abstract T load(Serializable id);

	public abstract T getById(Serializable id);

	public abstract void create(T o);

	public abstract void update(T o);

	public abstract void removeById(Serializable id);

	public abstract void remove(T entity);

	public abstract Query createQuery(String hql, Object... values);

	public abstract List<T> find(String hql, Object... values);

	public <ObjectType> ObjectType uniqueResult(String hql, Object... values);

	public DetachedCriteria createDetachedCriteria();

	public Pagination<T> findPageByCriteria(final DetachedCriteria detachedCriteria);

	public Pagination<T> findPageByCriteria(final DetachedCriteria detachedCriteria, final int startIndex);

	public Pagination<T> findPageByCriteria(final DetachedCriteria detachedCriteria, final int startIndex, final int pageSize);

}